﻿@using XStudio.XCRF.Data.Entities.BasicInfo;
@using XStudio.XCRF.Resources.Entities;
@model Guid
@{
    ViewBag.Title = "BasicInfoHisGridList";
    Layout = "~/Views/Shared/Master.cshtml";
}
@{Html.Telerik().Window().Name("BasicInfoHisGridWindow").Title("基本信息历史记录").HtmlAttributes(new { @class = "ContentLargeWindow" })
    .Buttons(buttons => buttons.Clear())
    .Content(
@<text>
    @(Html.Telerik().Grid<BasicInfo>()
    .Name("BasicInfoHisViewGrid")
    .DataKeys(keys => keys.Add(basic => basic.ID))
    .Columns(columns =>
    {
        columns.Bound(basic => basic.ID).Hidden();
        columns.BoundDateTime(basic => basic.LastModifyTime).Title(BaseEntityResource.LastModifyTime);
        columns.Bound(basic => basic.LastModifier.RealName).Title(BaseEntityResource.LastModifier);
        columns.BoundDateTime(basic => basic.CreateTime).Title(BaseEntityResource.CreateTime);
        columns.Bound(basic => basic.Creater.RealName).Title(BaseEntityResource.Creater);
        columns.Command(commands =>
        {
            commands.Custom("Detail").Text("查看详情").Ajax(true);
        }).Title("操作");
    })
    .ClientEvents(events =>
    {
        events.OnCommand("OnBasicInfoHisCommand");
    })
    .DataBinding(bind =>
    {
        bind.Ajax()
            .Select<BasicInfoController>(c => c._BasicHisGridList((Guid)Model));
    })
    )
</text>
    ).Render();
}
<script type="text/javascript">
    function BasicInfoDetail(id, time) {
        var tt = time.toString();
        var url = "@(Url.Action<BasicInfoController>(c => c._BasicInfoDetail(Guid.Empty, "mlgb")))";
        url = url.replace("@Guid.Empty", id);
        url = url.replace("mlgb", tt);
        url = url.replace("amp;", "");
        window.location = url;
//        var url = "(Url.Action<BasicInfoController>(c => c._BasicInfoDetail(Guid.Empty)))";
//        url = url.replace("Guid.Empty", id);
//        window.location = url;
    }
    function OnBasicInfoHisCommand(e) {
        switch (e.name) {
            case "Detail": BasicInfoDetail(e.dataItem.ID, e.dataItem.LastModifyTime); break; 
            //case "Detail": BasicInfoDetail(e.dataItem.ID); break;
        }
    }
</script>